package com.huawei.appgallery.foundation.ui.css;

import com.huawei.appgallery.foundation.ui.css.adapter.CSSValueDecoder;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSValue;
import o.ds;

public class CSSDeclaration {
    private ds<String, CSSValue> item = new ds(5);

    private static boolean checkBounds(int i, int i2, int i3) {
        if (i <= i2 && i >= 0 && i2 < i3) {
            return true;
        }
        return false;
    }

    public void add(String str, String str2) {
        CSSValue decode = CSSValueDecoder.getInstance().decode(str, str2);
        if (decode != null) {
            this.item.put(str, decode);
        }
    }

    public int getLength() {
        return this.item.size();
    }

    public String getPropertyName(int i) {
        if (checkBounds(0, i, this.item.size())) {
            return (String) this.item.ॱ(i);
        }
        return null;
    }

    public <T extends CSSValue> T getPropertyValue(String str) {
        CSSValue cSSValue = (CSSValue) this.item.get(str);
        return cSSValue != null ? cSSValue : null;
    }
}
